package HomeWork3_3;

import java.util.Scanner;

public class HomeWork3_3_2 {

    public static void pret(boolean[] prim) {
        prim[1] = true;
        for (int i = 2; i < 1000000; i++)
            for (int j = i*2; j < 1000000; j+=i)
                prim[j] = true;
    }
    public static void main(String[] args) {
        boolean[] prim = new boolean[1000010];
        pret(prim);
        int n;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个正整数n:");
        n = sc.nextInt();
        System.out.print("n =");
        int i;
        for (i = 2;n != 1 && i < 1000000; i++) {
            if(prim[i]) continue;
            if(n % i == 0){
                n /= i;
                System.out.print(" " + i);
                break;
            }
        }
        for (;n != 1 && i < 1000000; i++) {
            if(prim[i]) continue;
            while(n % i == 0){
                n /= i;
                System.out.print(" * " + i);
            }
        }
    }
}
